#!/usr/bin/env python2.3

from activist.Time import *
import time


repeatmonth = Repeating(time.time(), 3600, RepeatGenerateMonthly("second","sunday"))
secondsunday = time.asctime(repeatmonth.getNextAfter(time.time()))
print "second sunday:",secondsunday


repeatmonth = Repeating(time.time(), 3600, RepeatGenerateMonthly("first","monday"))
firstmonday = time.asctime(repeatmonth.getNextAfter(time.time()))
print "first monday:",firstmonday
print "  next one:",time.asctime(repeatmonth.getNextAfter(time.mktime(repeatmonth.getNextAfter(time.time()))) )


repeatweek = Repeating(time.time(), 3600, RepeatGenerateWeekly("","wednesday"))
print "next wednesday",time.asctime(repeatweek.getNextAfter(time.time()))

repeatweek = Repeating(time.time(), 3600, RepeatGenerateWeekly("second","wednesday"))
print "next (second) wednesday",time.asctime(repeatweek.getNextAfter(time.time()))

repeatweek = Repeating(time.time(), 3600, RepeatGenerateWeekly("fourth","wednesday"))
print "next (fourth) wednesday",time.asctime(repeatweek.getNextAfter(time.time()))

repeatweek = Repeating(time.time(), 3600, RepeatGenerateWeekly("second","wednesday"))
print "next (second) wednesday after Feb 3",time.asctime(repeatweek.getNextAfter(time.mktime(time.strptime("Thu Feb 3 00:00:00 2005"))))

